package com.qpx.eurekaconsumerfeign.service;

import com.qpx.dto.UserDto;
import com.qpx.vo.ResultEntity;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;


@Component
public class UserServiceFallBack implements FallbackFactory<UserService> {
    @Override
    public UserService create(Throwable throwable) {
        throwable.printStackTrace();
        return new UserService() {
            @Override
            public ResultEntity getUserList(UserDto userDto) {
                return ResultEntity.error("100001","查询用户列表失败");            }

            @Override
            public ResultEntity save(UserDto userDto) {
                return ResultEntity.error("100002","保存用户失败");
            }
        };
    }
//    @Override
//    public ResultEntity getUserList(UserDto userDto) {
//        return ResultEntity.error("100001","查询用户列表失败");
//    }
}
